package tr.edu.yildiz.ce.dap.apm;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import tr.edu.yildiz.ce.dap.apm.process.CommandReceiver;
import tr.edu.yildiz.ce.dap.apm.process.ProxyBroadCaster;
import tr.edu.yildiz.ce.dap.apm.util.AppCache;
import tr.edu.yildiz.ce.dap.apm.util.AppManagerInitializer;

public class ProxyProcessManager {
	
	ExecutorService executor = Executors.newFixedThreadPool(2);
	
	public void start() {
		AppManagerInitializer.initApplications();
		executor.execute(new ProxyBroadCaster(	ProxyProperties.getInstance().getProxyAddress(), 
												ProxyProperties.getInstance().getProxyPort(), 
												ProxyProperties.getInstance().getMcastAddress(), 
												ProxyProperties.getInstance().getMcastPort()));
		
		executor.execute(new CommandReceiver(	ProxyProperties.getInstance().getEncoding(),
												ProxyProperties.getInstance().getProxyPort()));
		AppCache.start();

	}
	
}
